
package it.csttech.date;

import java.util.MissingResourceException;
import java.util.ResourceBundle;

/**
 * OVERVIEW Utility class, binds the external string error messages to the
 * exception messages
 * 
 * @author marcello.felappi
 * @author marco.dalena
 */
public class Messages {

	/**
	 * name of the property file
	 */
	private static final String BUNDLE_NAME = "it.csttech.date.messages"; //$NON-NLS-1$
	/**
	 * Object resource bundle
	 */
	private static final ResourceBundle RESOURCE_BUNDLE =
		ResourceBundle.getBundle(BUNDLE_NAME);

	/**
	 * This method represents a constructor for the Messages class
	 */
	private Messages() {

	}

	/**
	 * This method gets the string from the property file
	 * 
	 * @param key
	 *            - the name of the string to be found
	 * @return the string to be found
	 */
	public static String getString(String key) {

		try {
			return RESOURCE_BUNDLE.getString(key);
		}
		catch (MissingResourceException e) {
			return '!' + key + '!';
		}
	}
}
